home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_02_04 / 2n04036a < prev    next >
Text File  |  1991-02-16  |  950b  |  29 lines

  1.  
  2. int single_drive_flag;       /* global flag used by SetFloppy() */
  3.  
  4. /*
  5.  * return 1 if single floppy system, else return 0
  6.  */
  7.  
  8. int SingleDrive(void){
  9.    char FloppyPresent, FloppyNumber;
  10.    FloppyPresent = peekb(0x40,0x10) & 1;
  11.    FloppyNumber = ((peekb(0x40,0x10) & 0xC0) >> 6) + 1;
  12.    single_drive_flag = (FloppyPresent &&
  13.             (FloppyNumber == 1)) ? 1 : 0;
  14.    }
  15.  
  16. void SetFloppy(char *filename){
  17.    char disk_name;
  18.    if(single_drive_flag){
  19.       if(filename[1]==':')        /*  If a drive was specified, */
  20.          disk_name=toupper(filename[0]);   /*  get the letter.  */
  21.       else                           /* Else get default drive  */
  22.          disk_name=getdisk()+0x41;   /*        ...just in case. */
  23.       if(disk_name=='A')             /* Adjust byte at          */
  24.          pokeb(0x50,4,0);            /* 0050:0004h as needed.   */
  25.       else if(disk_name=='B')
  26.          pokeb(0x50,4,1);
  27.       }
  28.    }
  29.